﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace Elysium.Demo.Recursos
{
    class MyDecimalFormatter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            Double MiNumero = (Double)value;
            return MiNumero.ToString("N");
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            return value;
            //DecimalFormatter decimalFormat = new DecimalFormatter();
            //decimalFormat.IsDecimalPointAlwaysDisplayed = true;
            //decimalFormat.IsGrouped = true;

            ////decimal doubleValue = (decimal)value;
            //var result = decimalFormat.Format(double.Parse(value.ToString()));
            //return result;
        }

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Double MiNumero = (Double)value;
            return MiNumero.ToString("N");
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value;
        }
    }
}
